package scau.redi.social_platform.controller.common;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import scau.redi.social_platform.common.util.FileUtil;
import scau.redi.social_platform.common.util.ResponseUtil;

import java.util.List;
import java.util.Map;

/**
 * @Author: Redi
 * @Date: 2022/5/8 10:12
 * @Description:
 */

@RestController
@Api(value = "upload",description = "文件上传")
@RequestMapping("/upload")
public class UploadController {

    @PostMapping("/uploadImg.do")
    @ApiOperation("上传图片")
    public Object uploadImage(@RequestParam("image") MultipartFile image) {
        String uploadPath = FileUtil.uploadFile(image);
        return ResponseUtil.success("图片上传成功",1, uploadPath);
    }

}
